package com.example.letgo.trip;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.letgo.Fragment.PersoncenterFragment;
import com.example.letgo.HomeActivity;
import com.example.letgo.R;
import com.example.letgo.model.Team;
import com.google.gson.Gson;

import java.io.File;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TripReleaseSuccess extends AppCompatActivity {


    @BindView(R.id.return_person)
    RelativeLayout returnPerson;
    @BindView(R.id.Imag)
    ImageView Imag;
    @BindView(R.id.content)
    TextView content;
    @BindView(R.id.startPlaceS)
    TextView startPlaceS;
    @BindView(R.id.endPlaceS)
    TextView endPlaceS;
    @BindView(R.id.endGroupTimeS)
    TextView endGroupTimeS;
    @BindView(R.id.trip_dateS)
    TextView tripDateS;
    @BindView(R.id.teamSexS)
    TextView teamSexS;
    @BindView(R.id.trip_costS)
    TextView tripCostS;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_trip_release_success);
        ButterKnife.bind(this);
        String teamJson = getIntent().getStringExtra("team");
        Team team = new Gson().fromJson(teamJson, Team.class);
        Log.e("Tag:team", team.getTeamText());
        content.setText(team.getTeamText().toString().trim());
        startPlaceS.setText(team.getTeamStartPlace().toString().trim());
        endPlaceS.setText(team.getTeamOverPlace());
        endGroupTimeS.setText(team.getTeamOverTime());
        tripDateS.setText(team.getTeamDate());
        teamSexS.setText(team.getTeamSex());
        tripCostS.setText(team.getTeamMoney());
        Imag.setImageURI(Uri.fromFile(new File(team.getTeamImage())));


    }

    @OnClick(R.id.return_person)
    public void onViewClicked() {
        Intent intent = new Intent(TripReleaseSuccess.this, HomeActivity.class);
        startActivity(intent);
        finish();
    }
}
